<?php 
include '../data/data.php';
$user=$_SESSION['user'];  //参数
$user_id=$_POST['user_id'];  //账号
$fuwua=date("Y-m-d");  //时间
$time=date("w",time( ));
$array = ["星期天","星期一","星期二","星期三","星期四","星期五","星期六"];
$time=date("w",time( ));
  if($array[$time]=='星期一'){
$xq=$qd['1'];
  }elseif($array[$time]=='星期二'){
$xq=$qd['2'];
  }elseif($array[$time]=='星期三'){
$xq=$qd['3'];
  }elseif($array[$time]=='星期四'){
$xq=$qd['4'];
  }elseif($array[$time]=='星期五'){
$xq=$qd['5'];
  }elseif($array[$time]=='星期六'){
$xq=$qd['6'];
  }elseif($array[$time]=='星期天'){
$xq=$qd['7'];
  }
if($user_id==''){
    $returndata = array("msg"=>false,"log"=>"参数错误","fwd"=>"");
    exit(json_encode($returndata));
}
if($user!=$user_id){
    $returndata = array("msg"=>false,"log"=>"参数错误","fwd"=>"");
    exit(json_encode($returndata));
}
if($user_id!=''){
$result= mysql_query("SELECT * FROM qiandao WHERE user='$user' and date='$fuwua'", $link);  
$row = mysql_fetch_array($result);
if($row[id]!=''){
    $returndata = array("msg"=>false,"log"=>"今日已签到","fwd"=>"");
    exit(json_encode($returndata));
}
#——————————————签到代码
    $result= mysql_query("INSERT INTO qiandao (userid, user, date, jifen) VALUES ('$dl', '$user', '$fuwua', '$xq')", $link);
  if($result){
  mysql_query("UPDATE  user  SET   jifen=jifen+'$xq' WHERE username='$user'", $link); 
  $returndata = array("msg"=>false,"log"=>"签到成功，获得".$xq."积分","fwd"=>"");
  exit(json_encode($returndata));
  }else{
    $returndata = array("msg"=>false,"log"=>"签到失败","fwd"=>"");
    exit(json_encode($returndata));
  }
    
  
}
?>